'use strict';
angular.module('app', [
    'ngAnimate',
    'ngCookies',
    'ngResource',
    'ngSanitize',
    'ngTouch',
    'ngStorage',
    'ui.router',
    'ncy-angular-breadcrumb',
    'ui.bootstrap',
    'ui.utils',    
    'oc.lazyLoad',
    'angularMoment',
    
]).run(function ($rootScope, $modal, $localStorage, $state, $http, $templateCache) {
    $rootScope.API = 'http://localhost:12385/',
    //$rootScope.API = 'http://admintest.makemoney.life/',
    $rootScope.GianTiepAPI = $rootScope.API+'CN_TrucTiep',
    $rootScope.TrucTiepAPI = $rootScope.API+'TrucTiep',
    $rootScope.PinManageAPI = $rootScope.API+'Pin/',
    $rootScope.BitcoinAPI = $rootScope.API + 'BitCoinPayment/',      
    $rootScope.APIUrl = $rootScope.API + 'JsonAccount/',
    $rootScope.APITransactionUrl = $rootScope.API + 'JsonTransaction/',
    $rootScope.APIAccount = $rootScope.APIUrl + 'Login',
    $rootScope.APIEditProfile = $rootScope.APIUrl + 'EditProfile';    
    if ($localStorage.user == null) { 
        $state.go('login');
    } else {
        $rootScope.token = $localStorage.user.SessionId
    }    
    $rootScope.$on('$routeChangeStart', function (event, next, current) {
        if (typeof (current) !== 'undefined') {
            $templateCache.remove(current.templateUrl);
        }
    });
})

//app.config(['$httpProvider', function ($httpProvider) {
//    $httpProvider.defaults.headers.post['token'] = 'your_token';
//}]);
